/*
 * SUP.H Version 1.01 (C)1995,1996 HUDSON SOFT
 * HuC6270(7UP)関連 Ｃコンパイラ用ヘッダーファイル(SUP.H)
 */
#ifndef _SUP_H_
#define _SUP_H_

#include	<system.h>

/* register set macros */

#define DEV70A 0
#define DEV70B 1

#define _put_70_ar(x,n) (m_70_reg.ar70[n] = x,\
			 (n == DEV70A ? __OUTPORTH(IO_70A_AR,x):\
			  __OUTPORTH(IO_70B_AR,x)))

#define _put_70_dr(x,n) (void)(n == DEV70A ?\
			 __OUTPORTH(IO_70A_DR,x):\
			 __OUTPORTH(IO_70B_DR,x))

#define _get_70_sr(n) (n == DEV70A ?\
			 __INPORTH(IO_70A_SR):\
			 __INPORTH(IO_70B_SR))


struct SCRL70 {u_short bxr70,byr70;};
struct MREG70 {u_short ar70[2],cr70[2];};
struct REG70 {u_short regno,regdat;};

extern zero struct MREG70 m_70_reg;

void init_70(void);

void set_70_ar(int regno,int devno);

u_short get_70_sr(int devno);

void set_70_dr(u_short data,int devno);

void set_70_cr(u_short crdat,int devno);

void set_70_regs(struct REG70 *regs,int devno);
#define REGTERM 0xffff

struct DP70 {u_short mwr,hsr,hdr,vpr,vdw,vcr,dcr;};
void setup_70_display(struct DP70 *pram,int devno);

void sat_trans_trg(u_short sat_adrs,int devno);

void set_70_scrl(struct SCRL70 *scrl,int devno);

void set_70_iw(int iw_data,int devno);
int get_70_iw(int devno);
#define IW_01 0
#define IW_20 1
#define IW_40 2
#define IW_80 3

int set_70_irqbit(int irqbit,int devno);
int reset_70_irqbit(int irqbit,int devno);
#define IE_CC 1
#define IE_OC 2
#define IE_RC 4
#define IE_VC 8

void set_70_mode(int mode,int devno);
int get_70_mode(int devno);
#define BURST 0
#define SPR_ON 1
#define BG_ON 2
#define SPR_BG_ON 3

void write_vram(u_short vadrs,u_short vdata,int devno);
u_short read_vram(u_short vadrs,int devno);
void mram_to_vram(u_short vadrs,u_short *vdata,int len,int devno);
u_short *vram_to_mram(u_short vadrs,u_short *buff,int len,int devno);

void fill_vram( u_short svadrs, u_short value, int vlength, int devno );
void fill_vramp( u_short svadrs, u_short *ptbl, int vlength, int devno );

#endif /* _SUP_H_ */
